package com.gper.edu.hight_level_function

case class Email(subject : String, text :String,sender :String,recipient :String)

object HeightLevelFunctionDemo {
  //定义类型为Email => Boolean的谓词函数
  type EmailFilter = Email => Boolean
  //定义了一个邮件过滤函数
  def emailForUser(emails:Set[Email],f:EmailFilter) = emails.filter(f)
  //定义一个sendByOneOf函数，它的参数为Set[String] 返回是EmailFilter函数
  val sendByOneOf : Set[String] => EmailFilter =
    senders =>
      email => senders.contains(email.sender)

  def main(args: Array[String]): Unit = {
    println("***")
  }
}
